package com.example.fmgidsprototype;

import java.util.List;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import com.example.fmgidsprototype.data.DataManager;
import com.example.fmgidsprototype.model.Venue;

public class MyFragmentPagerAdapter extends FragmentStatePagerAdapter{
	
	private List<Venue> currentVenues;
	private int pageCount = 0;
	private Context ctx;
	private DataManager dm;
	private FmGidsPrototypeApp app;
	

	public MyFragmentPagerAdapter(FragmentManager fragmentManager, List<Venue> currentVenues, 
			Context ctx, DataManager dm) {
	        super(fragmentManager);
	        this.currentVenues = currentVenues;
	        pageCount = currentVenues.size();
	        this.ctx = ctx;
	        this.dm = dm;
	}
	
	public Fragment getItem(int arg0) {
		VenueDetailFragment venueDetailFragment = new VenueDetailFragment(ctx);
		venueDetailFragment.setContext(ctx);
		venueDetailFragment.setDataManager(dm);
		Bundle data = new Bundle();
		data.putSerializable(AppConstants.SELECTED_VENUE, currentVenues.get(arg0));
		venueDetailFragment.setArguments(data);
		return venueDetailFragment;
	}

	public int getCount() {
		// TODO Auto-generated method stub
		return this.pageCount;
	}

}
